﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Expressionista.Extensions.Strings
{
	public static class StringExtender
	{
		public static string JoinStrings(this List<string> list, string separator)
		{
			switch (list.Count)
			{
				case 0:
					return string.Empty;
				case 1:
					return list[0];
			}

			StringBuilder sb = new StringBuilder();
			for (int i = 0; i < list.Count - 1; i++)
			{
				sb.Append(list[i]);
				sb.Append(separator);
			}

			sb.Append(list[list.Count - 1]);

			return sb.ToString();
		}

		public static string Format(this string src, params object[] args)
		{
			return string.Format(src, args);
		}
	}
}
